import {Component} from '@angular/core';
import {UserEntity} from "../../../user/model/userEntity";
import {UserService} from "../../../user/service/user.service";
import {CurrentUserInfo} from "../../../user/model/currentUserInfo";
declare var $: any;

@Component({
    moduleId: module.id,
    selector: 'menu-component',
    templateUrl: "./menu.html",
})
export class MenuComponent {
    currentUser: CurrentUserInfo = new CurrentUserInfo;
    constructor(private userService: UserService) {

    }


    ngOnInit(): void {

        this.userService.getCurrentUserInfo().then((data: CurrentUserInfo)=> {
            this.currentUser = data;
        })

        $(function () {
            var resetFrontMiddleHeight = function () {
                $("#main").height($(window).height() - 50);
            }
            resetFrontMiddleHeight()


            $(window).resize(function () {
                resetFrontMiddleHeight()
            });
        });

        $(".menuOne").on("mouseover", function () {
            $(this).css("background-color", "rgb(103, 110, 117)")
        })


        $(".menuOne").on("mouseout", function () {
            $(this).css("background-color", "#22282E")
        })

        $(".menuOne").on("click", function () {
            var target = $($(this).children(".coin"))
            if (target.hasClass("fa-caret-down")) {
                target.removeClass("fa-caret-down");
                target.addClass("fa-caret-up")
                $(this).siblings("ul").show()

            } else if (target.hasClass("fa-caret-up")) {
                target.removeClass("fa-caret-up");
                target.addClass("fa-caret-down")
                $(this).siblings("ul").hide()

            }
        })


        $(".menuTwo").on("mouseover", function () {
            $(this).css("background-color", "rgb(103, 110, 117)")
        })


        $(".menuTwo").on("mouseout", function () {
            $(this).css("background-color", "")
        })
    }
}